package com.ywang.hqhp.rest;

import com.ywang.hqhp.annotation.Idempotent;
import com.ywang.hqhp.conf.TokenService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

//测试
@RestController
public class TestController {
    private final TokenService tokenService;

    public TestController(TokenService tokenService) {
        this.tokenService = tokenService;
    }

    @GetMapping(value = "/getToken")
    public String getToken(){
        return tokenService.createToken();
    }

    @PostMapping(value = "test")
    public String test(){
        return "test";
    }

    @PostMapping(value = "/test1")
    @Idempotent
    public String testOne(){
        return "test1";
    }
}
